home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / dos_win / winsock / hacklist / 94-05 / text0012.txt < prev    next >
Encoding:
Text File  |  1994-05-19  |  2.2 KB  |  55 lines

  1. >So we're faced then with either having the spec say that:
  2. >  - FD_CLOSE doesn't occur *at all* on a socket that initiates the close
  3. >     (with shutdown() or with closesocket()), since in effect it just
  4. >     tells you something you already know.
  5. >                                   OR
  6. >  - FD_CLOSE does *not* occur after calling closesocket() to initiate the
  7. >     close of a TCP connection, but it *does* occur after calling 
  8. >  shutdown()
  9. >
  10. >That's about as transparent as my cafe latte.
  11. >
  12. I don't have a problem with it.  You get an FD_CLOSE when a _socket_ goes
  13. into FIN_WAIT state.   After a closesocket the socket does not exist
  14. (altho the connection might), so you won't get any more messages.
  15.  
  16. >> and if an app really needs
  17. >>  to find out if the connection closed gracefully, it should hang onto 
  18. >> the
  19. >>  descriptor, use shutdown(1) to send a FIN, then read to EOF.
  20. >
  21. >I couldn't agree with this more.  The problem is that most people
  22. >don't know this method, as evidenced by most WinSock applications
  23. >around these days.
  24.  
  25. OK, so maybe we need to throw a mention of it in the FAQ. 
  26.  
  27. >>  I still maintain that closesocket invalidates the descriptor and what
  28. >>  would an app do if it didn't get the FD_CLOSE it expected?  Reset the
  29. >>  connection?  It can't, because it has no reference to the connection
  30. >> now
  31. >>  that the socket descriptor is gone.   It might display a warning to
  32.  >> the
  33. >>  user, but since it can't take any meaningful steps to correct the 
  34. >> problem,
  35. >>  this would amount to "I've fallen, and I can't get up!"
  36. >
  37. >As much as I like that error message, I think it might be more
  38. >meaningful to a user to say something like "the connection on
  39. >the remote host was disconnected unexpectedly".
  40. >
  41. Actually, the app _didn't get an FD_CLOSE, so the message would be more
  42. like "the connection on the remote host unexpectedly didn't disconnect". 
  43. Huh?  :)   I still don't know what meaningful action an app could take
  44. based on the knowledge that the connection associated with a nonexistant
  45. socket has been closed.
  46.  
  47.  
  48. ****************************************
  49. Bruce A Backman (Bruce@FrontierTech.COM)
  50. Frontier Technologies Corporation
  51. 10201 North Port Washington Road
  52. Mequon,  WI  53092
  53. ****************************************
  54.  
  55.